<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title>收银台</title>
		<#assign base=request.contextPath  />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="${base}/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="${base}/css/style.css" />
		<link rel="stylesheet" type="text/css" href="${base}/fonts/iconfont.css"/>
        <script src="${base}/js/jquery.js"></script>
	</head>
    <style type="text/css">

        .mui-card-cooter{
            padding: 30px 0;
            text-align: center;
        }
        p {
            font-size: 13px;
            margin-bottom: 0px;
            color: #8f8f94;
        }
        .mui-btn-outlined{
            border-radius: 30px;
            padding: 5px 10px;
        }
        .borTandB6px{
            border-bottom: 6px solid #F2F2F2;
        }
        .footer{
            position: absolute;
            width: 100%;
            text-align: center;
            bottom: 0;
            padding: 10px;
        }
        .mui-btn-red{
            width: 100%;
        }
        .mui-icon-weixin {
            font-size: 14px;
            background-color: #3bf305;
            color: white;
            padding: 2px;
            border-radius: 4px;

        }
    </style>
	<body>
	<div class="mui-content">
        <div class="borTandB6px">
            <div class="mui-card-cooter">
                <h3>￥${moeny?number/100}</h3>
                <p>支付金额</p>
            </div>
        </div>

        <div class="mui-card-header">
            <p>支付方式</p>
            <p><span class="mui-icon mui-icon-weixin"></span> 微信支付</p>
        </div>
        <div class="mui-card-header">
            <p>支付状态</p>
            <p id="payStatus">正在支付...</p>
        </div>
        <div class="footer">
            <button type="button" onclick="pay()" class="mui-btn mui-btn-red mui-btn-outlined">重新支付</button>
        </div>
	</div>
		<script src="${base}js/mui.js"></script>



		<script type="text/javascript">
            pay();
    function pay(){
        var a= {
            "appId":"${data.appId}",     //公众号名称，由商户传入
            "timeStamp":"${data.timeStamp}",         //时间戳，自1970年以来的秒数
            "nonceStr":"${data.nonceStr}", //随机串
            "package":"${data.packageValue}",
            "signType":"${data.signType}",         //微信签名方式：
            "paySign":"${data.paySign}" //微信签名
        };
        function onBridgeReady(){
            WeixinJSBridge.invoke(
                    'getBrandWCPayRequest',a,
                    function(res){
                        if(res.err_msg == "get_brand_wcpay_request:ok" ){
                            // 使用以上方式判断前端返回,微信团队郑重提示：
                            //res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
                            alert("支付成功")
                            $("#payStatus").html("支付成功")
                            window.location.href='${base}/wx/user/successful_payment.html'
                        }else{
                            alert("支付失败")
                            $("#payStatus").html("支付失败")
                            window.location.href='${base}/wx/user/error_payment.html'
                        }
                    });
        }
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        }else{
            onBridgeReady();
        }

    }

		</script>



	</body>
</html>
